package com.zidongxiangxi.clock.server.repository.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 闹钟信息
 * </p>
 *
 * @author chenxudong
 * @since 2021-02-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Clock implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 定闹钟的应用名
     */
    private String application;

    /**
     * 业务id
     */
    private String businessId;

    /**
     * 回调内容
     */
    private String payload;

    /**
     * 目标的闹钟时间
     */
    private Long targetRingAt;

    /**
     * 最晚的闹钟时间，超过这个时间就不回调了。未空表示没有限制，不管多晚都要回调
     */
    private Long latestRingAt;

    /**
     * 下一次尝试时间
     */
    private Long nextTryTime;

    /**
     * 尝试次数
     */
    private Integer retryTimes;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;


    public static final String ID = "id";

    public static final String APPLICATION = "application";

    public static final String BUSINESS_ID = "business_id";

    public static final String PAYLOAD = "payload";

    public static final String TARGET_RING_AT = "target_ring_at";

    public static final String LATEST_RING_AT = "latest_ring_at";

    public static final String NEXT_TRY_TIME = "next_try_time";

    public static final String RETRY_TIMES = "retry_times";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

}
